package com.xyzwps.ewa.modules.global

import com.xyzwps.ewa.ext.getStringConfig
import io.ktor.http.*
import io.ktor.server.application.*
import io.ktor.server.response.*
import io.ktor.server.routing.*
import kotlinx.serialization.Serializable

@Serializable
data class GlobalInfo(val title: String)

fun Route.globalRoutes() {
    val globalInfo = GlobalInfo(environment?.getStringConfig("ewa.title") ?: "EWA")
    // Read user
    get("/info") {
        call.respond(HttpStatusCode.OK, globalInfo)
    }
}
